**************************************************
* This program performs the main empirical tests *
* on M&A performance                             *
* reported in Table 6 and robustness tables      *
**************************************************








*********************************************************************
* Models 1 & 2 Deal announcement return and probability of bad deal *	
*********************************************************************

	use "C:\cow\ma.dta",clear
	drop if a_fyear<1996
	drop if a_sic >= 4900 & a_sic <= 4999
	drop if a_sic >= 9000 & a_sic <= 9999
	encode a_cusip, gen(a_cusipFE)
	encode a_state, gen(a_stateFE)
	encode t_incorp, gen(t_incorpFE)	
	drop if missing(a_state)
	drop if missing(a_incorp)
	drop if inlist(a_incorp, "AS", "INTL", "PR", "TT", "VI")
	drop if missing(l_a_mktcap, a_q, a_lvb, a_amihudliq, a_roa, rel_size, d_t_private, d_t_sub ,d_allcash, d_tender, d_hostile, d_compete, d_toehold, d_lockup, d_moe, d_same2sic)

	local statelist "DE OK MO KS TX NV NJ MD WA"
	gen treatment = 0
	foreach state of local statelist {
			replace treatment = 1 if a_incorp == "`state'"
	}

	
	
	*Create macros for date when law was passed
	local DE_cow = date("01Jul2000","DMY")
	local OK_cow = date("01Nov2001","DMY")
	local MO_cow = date("01Oct2003","DMY")
	local KS_cow = date("01Jan2005","DMY")
	local TX_cow = date("01Jan2006","DMY")
	local NV_cow = date("01Oct2007","DMY")
	local NJ_cow = date("11Mar2011","DMY")
	local MD_cow = date("01Oct2014","DMY")
	local WA_cow = date("01Jan2016","DMY")
	

	* adjust calendar year of fyeendt to be next year if fyenddt month < cow law date
	gen ayear = year(a_fyenddt)
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
			replace ayear = year(a_fyenddt)-1 if a_incorp == "`state'" & month(a_fyenddt) < month(``state'_cow')
			}

	*cow: indicator equal to one if acquirer is incorporated in a state that has passed a COW law
	gen a_cow = 0
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
			replace a_cow = 1 if a_incorp == "`state'" & ayear >= year(``state'_cow')
			}

	*Create macros for date when law was passed
	local DE_cow = date("01Jul2000","DMY")
	local OK_cow = date("01Nov2001","DMY")
	local MO_cow = date("01Oct2003","DMY")
	local KS_cow = date("01Jan2005","DMY")
	local TX_cow = date("01Jan2006","DMY")
	local NV_cow = date("01Oct2007","DMY")
	local NJ_cow = date("11Mar2011","DMY")
	local MD_cow = date("01Oct2014","DMY")
	local WA_cow = date("01Jan2016","DMY")

	* adjust calendar year of fyeendt to be next year if fyenddt month < cow law date
	gen tyear = year(t_fyenddt)
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
			replace tyear = year(t_fyenddt)-1 if t_incorp == "`state'" & month(t_fyenddt) < month(``state'_cow')
			}
	*cow: indicator equal to one if target is incorporated in a state that has passed a COW law
	gen tgt_cow = 0
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
			replace tgt_cow = 1 if t_incorp == "`state'" & tyear >= year(``state'_cow')
			}

	gen a_cow_a_car0101_r=a_cow*a_car0101_r
	gen a_cow_a_car0101=a_cow*a_car0101
	gen a_car0101_r100=a_car0101_r*100
	gen a_cow_a_car0101_r100=a_cow*a_car0101_r100

	
	
	
*********************************
* Table 6 Panel A Summary stats *
*********************************

	drop if d_complete==0
	distinct a_cusip

	winsor2 dealvalue_rd a_car0101_r a_mktcap_rd a_q a_lvb a_amihudliq a_roa rel_size, replace cuts(1 99) replace
	estpost tabstat firmage a_cow dealvalue dealvalue_rd a_car0101_r a_car0101_r_neg a_mktcap a_mktcap_rd a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic, statistics ( mean sd min p25 p50 p75 ) columns(statistics)
	
	
*******************************
* Table 6 Panel B Regressions *
*******************************
	
	reghdfe a_car0101_r100     a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic , absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	reghdfe a_car0101_r_neg  a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic , absorb(a_state a_ind3d yearad) vce(cluster a_incorp)

	
		
	
	

	

	
	
*======================================*
*          ROBUSTNESS TESTS	           *
*======================================*
	
		* noncompete index		
		gen nceindex=0
		replace nceindex=5 if a_incorp=="AL"
		replace nceindex=3 if a_incorp=="AK"
		replace nceindex=3 if a_incorp=="AZ"
		replace nceindex=5 if a_incorp=="AR"
		replace nceindex=0 if a_incorp=="CA"
		replace nceindex=1 if a_incorp=="CO"
		replace nceindex=2 if a_incorp=="CO" & a_fyear>=1992 
		replace nceindex=3 if a_incorp=="CO" & a_fyear>=2012 
		replace nceindex=4 if a_incorp=="CT"
		replace nceindex=3 if a_incorp=="CT" & a_fyear>=1992
		replace nceindex=6 if a_incorp=="DE"
		replace nceindex=7 if a_incorp=="DC"
		replace nceindex=7 if a_incorp=="FL"
		replace nceindex=9 if a_incorp=="FL" & a_fyear>=1997
		replace nceindex=5 if a_incorp=="GA"
		replace nceindex=6 if a_incorp=="GA" & a_fyear>=2005
		replace nceindex=7 if a_incorp=="GA" & a_fyear>=2011
		replace nceindex=3 if a_incorp=="HI"
		replace nceindex=4 if a_incorp=="HI" & a_fyear>=2007
		replace nceindex=5 if a_incorp=="ID"
		replace nceindex=6 if a_incorp=="ID" & a_fyear>=1992
		replace nceindex=7 if a_incorp=="ID" & a_fyear>=2009
		replace nceindex=5 if a_incorp=="IL"
		replace nceindex=6 if a_incorp=="IL" & (2012<=a_fyear<=2013) 
		replace nceindex=5 if a_incorp=="IN"
		replace nceindex=6 if a_incorp=="IA"
		replace nceindex=6 if a_incorp=="KS"
		replace nceindex=7 if a_incorp=="KS" & a_fyear>=2008
		replace nceindex=6 if a_incorp=="KY"
		replace nceindex=5 if a_incorp=="KY" & a_fyear>=2015
		replace nceindex=2 if a_incorp=="LA" & a_fyear<=1991
		replace nceindex=4 if a_incorp=="LA" & (1992<=a_fyear<=2001)
		replace nceindex=4 if a_incorp=="LA" & (2004<=a_fyear)
		replace nceindex=4 if a_incorp=="ME"
		replace nceindex=5 if a_incorp=="MD"
		replace nceindex=6 if a_incorp=="MA"
		replace nceindex=5 if a_incorp=="MI"
		replace nceindex=5 if a_incorp=="MN"
		replace nceindex=4 if a_incorp=="MS"
		replace nceindex=5 if a_incorp=="MS" & a_fyear>=2009
		replace nceindex=7 if a_incorp=="MO"
		replace nceindex=2 if a_incorp=="MT"
		replace nceindex=4 if a_incorp=="NE"
		replace nceindex=5 if a_incorp=="NV"
		replace nceindex=2 if a_incorp=="NH"
		replace nceindex=1 if a_incorp=="NH" & a_fyear>=2013
		replace nceindex=4 if a_incorp=="NJ"
		replace nceindex=2 if a_incorp=="NM"
		replace nceindex=3 if a_incorp=="NY"
		replace nceindex=4 if a_incorp=="NC"
		replace nceindex=0 if a_incorp=="ND"
		replace nceindex=4 if a_incorp=="OH"
		replace nceindex=5 if a_incorp=="OH" & a_fyear>=1992
		replace nceindex=6 if a_incorp=="OH" & a_fyear>=2005
		replace nceindex=1 if a_incorp=="OK"
		replace nceindex=6 if a_incorp=="OR"
		replace nceindex=5 if a_incorp=="OR" & a_fyear>=2008
		replace nceindex=6 if a_incorp=="PA"
		replace nceindex=3 if a_incorp=="RI"
		replace nceindex=5 if a_incorp=="SC"
		replace nceindex=4 if a_incorp=="SC" & a_fyear>=2011
		replace nceindex=5 if a_incorp=="SD"
		replace nceindex=7 if a_incorp=="TN"
		replace nceindex=5 if a_incorp=="TX"
		replace nceindex=3 if a_incorp=="TX" & a_fyear>=1995
		replace nceindex=4 if a_incorp=="TX" & a_fyear>=2011
		replace nceindex=6 if a_incorp=="UT"
		replace nceindex=5 if a_incorp=="VT"
		replace nceindex=6 if a_incorp=="VT" & a_fyear>=2006
		replace nceindex=4 if a_incorp=="VA" & (1980<=a_fyear<=1991)
		replace nceindex=3 if a_incorp=="VA" & (1992<=a_fyear<=2005)
		replace nceindex=4 if a_incorp=="VA" & (2006<=a_fyear<=2013)
		replace nceindex=5 if a_incorp=="VA" & (2014<=a_fyear)
		replace nceindex=5 if a_incorp=="WA"
		replace nceindex=2 if a_incorp=="WV" 
		replace nceindex=3 if a_incorp=="WV" & (1984<=a_fyear<=1991)
		replace nceindex=3 if a_incorp=="WI"
		replace nceindex=4 if a_incorp=="WI" & a_fyear>=2010
		replace nceindex=5 if a_incorp=="WI" & a_fyear>=2016
		replace nceindex=4 if a_incorp=="WY"

		* universal demand law
		gen ud=0
		replace ud=1 if a_incorp=="UT" & a_fyear>=1992
		replace ud=1 if a_incorp=="NH" & a_fyear>=1993
		replace ud=1 if a_incorp=="MS" & a_fyear>=1993
		replace ud=1 if a_incorp=="NC" & a_fyear>=1995
		replace ud=1 if a_incorp=="AZ" & a_fyear>=1996
		replace ud=1 if a_incorp=="NE" & a_fyear>=1996
		replace ud=1 if a_incorp=="CT" & a_fyear>=1997
		replace ud=1 if a_incorp=="ME" & a_fyear>=1997
		replace ud=1 if a_incorp=="PA" & a_fyear>=1997
		replace ud=1 if a_incorp=="TX" & a_fyear>=1997
		replace ud=1 if a_incorp=="WY" & a_fyear>=1997
		replace ud=1 if a_incorp=="ID" & a_fyear>=1998
		replace ud=1 if a_incorp=="HI" & a_fyear>=2001
		replace ud=1 if a_incorp=="IA" & a_fyear>=2003
		replace ud=1 if a_incorp=="MA" & a_fyear>=2004
		replace ud=1 if a_incorp=="RI" & a_fyear>=2005
		replace ud=1 if a_incorp=="SD" & a_fyear>=2005
		
		* The five most common types of antitakeover laws adopted by states since 1982. The law types are: control share acquisition laws (CS), business combination laws (BC), fair price laws (FP), directors' duties laws (DD), and poison pill laws (PP)
 
		* cs law
		gen cs=0
		replace cs =1 if a_incorp=="AZ" & a_fyear>=1987
		replace cs =1 if a_incorp=="FL" & a_fyear>=1987
		replace cs =1 if a_incorp=="HI" & a_fyear>=1985
		replace cs =1 if a_incorp=="ID" & a_fyear>=1988
		replace cs =1 if a_incorp=="IN" & a_fyear>=1986
		replace cs =1 if a_incorp=="KS" & a_fyear>=1988
		replace cs =1 if a_incorp=="LA" & a_fyear>=1987
		replace cs =1 if a_incorp=="MD" & a_fyear>=1989
		replace cs =1 if a_incorp=="MA" & a_fyear>=1987
		replace cs =1 if a_incorp=="MI" & a_fyear>=1988
		replace cs =1 if a_incorp=="MN" & a_fyear>=1984
		replace cs =1 if a_incorp=="MS" & a_fyear>=1990
		replace cs =1 if a_incorp=="MO" & a_fyear>=1984
		replace cs =1 if a_incorp=="NE" & a_fyear>=1988
		replace cs =1 if a_incorp=="NV" & a_fyear>=1987
		replace cs =1 if a_incorp=="NC" & a_fyear>=1987
		replace cs =1 if a_incorp=="OH" & a_fyear>=1982
		replace cs =1 if a_incorp=="OK" & a_fyear>=1987
		replace cs =1 if a_incorp=="OR" & a_fyear>=1987
		replace cs =1 if a_incorp=="PA" & a_fyear>=1990
		replace cs =1 if a_incorp=="SC" & a_fyear>=1988
		replace cs =1 if a_incorp=="SD" & a_fyear>=1990
		replace cs =1 if a_incorp=="TN" & a_fyear>=1988
		replace cs =1 if a_incorp=="UT" & a_fyear>=1987
		replace cs =1 if a_incorp=="VA" & a_fyear>=1989
		replace cs =1 if a_incorp=="WI" & a_fyear>=1984
		replace cs =1 if a_incorp=="WY" & a_fyear>=1990

		* bc law
		gen bc=0
		replace bc =1 if a_incorp=="AZ" & a_fyear>=1987
		replace bc =1 if a_incorp=="CT" & a_fyear>=1988
		replace bc =1 if a_incorp=="DE" & a_fyear>=1988
		replace bc =1 if a_incorp=="GA" & a_fyear>=1988
		replace bc =1 if a_incorp=="ID" & a_fyear>=1988
		replace bc =1 if a_incorp=="IL" & a_fyear>=1989
		replace bc =1 if a_incorp=="IN" & a_fyear>=1986
		replace bc =1 if a_incorp=="IA" & a_fyear>=1997
		replace bc =1 if a_incorp=="KS" & a_fyear>=1989
		replace bc =1 if a_incorp=="KY" & a_fyear>=1986
		replace bc =1 if a_incorp=="ME" & a_fyear>=1988
		replace bc =1 if a_incorp=="MD" & a_fyear>=1989
		replace bc =1 if a_incorp=="MA" & a_fyear>=1989
		replace bc =1 if a_incorp=="MI" & a_fyear>=1989
		replace bc =1 if a_incorp=="MN" & a_fyear>=1987
		replace bc =1 if a_incorp=="MO" & a_fyear>=1986
		replace bc =1 if a_incorp=="NE" & a_fyear>=1988
		replace bc =1 if a_incorp=="NV" & a_fyear>=1991
		replace bc =1 if a_incorp=="NJ" & a_fyear>=1986
		replace bc =1 if a_incorp=="NY" & a_fyear>=1985
		replace bc =1 if a_incorp=="OH" & a_fyear>=1990
		replace bc =1 if a_incorp=="OK" & a_fyear>=1991
		replace bc =1 if a_incorp=="OR" & a_fyear>=1991
		replace bc =1 if a_incorp=="PA" & a_fyear>=1988
		replace bc =1 if a_incorp=="RI" & a_fyear>=1990
		replace bc =1 if a_incorp=="SC" & a_fyear>=1988
		replace bc =1 if a_incorp=="SD" & a_fyear>=1990
		replace bc =1 if a_incorp=="TN" & a_fyear>=1988
		replace bc =1 if a_incorp=="TX" & a_fyear>=1997
		replace bc =1 if a_incorp=="VA" & a_fyear>=1988
		replace bc =1 if a_incorp=="WA" & a_fyear>=1987
		replace bc =1 if a_incorp=="WI" & a_fyear>=1987
		replace bc =1 if a_incorp=="WY" & a_fyear>=1989

		* fp law
		gen fp=0
		replace fp =1 if a_incorp=="AZ" & a_fyear>=1987
		replace fp =1 if a_incorp=="CT" & a_fyear>=1984
		replace fp =1 if a_incorp=="FL" & a_fyear>=1987
		replace fp =1 if a_incorp=="GA" & a_fyear>=1985
		replace fp =1 if a_incorp=="ID" & a_fyear>=1988
		replace fp =1 if a_incorp=="IL" & a_fyear>=1985
		replace fp =1 if a_incorp=="IN" & a_fyear>=1986
		replace fp =1 if a_incorp=="KY" & a_fyear>=1984
		replace fp =1 if a_incorp=="LA" & a_fyear>=1984
		replace fp =1 if a_incorp=="MD" & a_fyear>=1983
		replace fp =1 if a_incorp=="MI" & a_fyear>=1984
		replace fp =1 if a_incorp=="MN" & a_fyear>=1991
		replace fp =1 if a_incorp=="MS" & a_fyear>=1985
		replace fp =1 if a_incorp=="MO" & a_fyear>=1986
		replace fp =1 if a_incorp=="NV" & a_fyear>=1991
		replace fp =1 if a_incorp=="NJ" & a_fyear>=1986
		replace fp =1 if a_incorp=="NY" & a_fyear>=1985
		replace fp =1 if a_incorp=="NC" & a_fyear>=1987
		replace fp =1 if a_incorp=="OH" & a_fyear>=1990
		replace fp =1 if a_incorp=="PA" & a_fyear>=1988
		replace fp =1 if a_incorp=="RI" & a_fyear>=1990
		replace fp =1 if a_incorp=="SC" & a_fyear>=1988
		replace fp =1 if a_incorp=="SD" & a_fyear>=1990
		replace fp =1 if a_incorp=="TN" & a_fyear>=1988
		replace fp =1 if a_incorp=="VA" & a_fyear>=1985
		replace fp =1 if a_incorp=="WA" & a_fyear>=1985
		replace fp =1 if a_incorp=="WI" & a_fyear>=1984

		* dd law
		gen dd=0
		replace dd =1 if a_incorp=="AZ" & a_fyear>=1987
		replace dd =1 if a_incorp=="CT" & a_fyear>=1988
		replace dd =1 if a_incorp=="FL" & a_fyear>=1989
		replace dd =1 if a_incorp=="GA" & a_fyear>=1989
		replace dd =1 if a_incorp=="HI" & a_fyear>=1989
		replace dd =1 if a_incorp=="ID" & a_fyear>=1988
		replace dd =1 if a_incorp=="IL" & a_fyear>=1985
		replace dd =1 if a_incorp=="IN" & a_fyear>=1986
		replace dd =1 if a_incorp=="IA" & a_fyear>=1989
		replace dd =1 if a_incorp=="KY" & a_fyear>=1988
		replace dd =1 if a_incorp=="LA" & a_fyear>=1988
		replace dd =1 if a_incorp=="ME" & a_fyear>=1985
		replace dd =1 if a_incorp=="MD" & a_fyear>=1999
		replace dd =1 if a_incorp=="MA" & a_fyear>=1989
		replace dd =1 if a_incorp=="MN" & a_fyear>=1987
		replace dd =1 if a_incorp=="MS" & a_fyear>=1990
		replace dd =1 if a_incorp=="MO" & a_fyear>=1986
		replace dd =1 if a_incorp=="NE" & a_fyear>=1988
		replace dd =1 if a_incorp=="NV" & a_fyear>=1991
		replace dd =1 if a_incorp=="NJ" & a_fyear>=1989
		replace dd =1 if a_incorp=="NM" & a_fyear>=1987
		replace dd =1 if a_incorp=="NY" & a_fyear>=1987
		replace dd =1 if a_incorp=="NC" & a_fyear>=1993
		replace dd =1 if a_incorp=="ND" & a_fyear>=1993
		replace dd =1 if a_incorp=="OH" & a_fyear>=1984
		replace dd =1 if a_incorp=="OR" & a_fyear>=1989
		replace dd =1 if a_incorp=="PA" & a_fyear>=1990
		replace dd =1 if a_incorp=="RI" & a_fyear>=1990
		replace dd =1 if a_incorp=="SD" & a_fyear>=1990
		replace dd =1 if a_incorp=="TN" & a_fyear>=1988
		replace dd =1 if a_incorp=="TX" & a_fyear>=2003
		replace dd =1 if a_incorp=="VT" & a_fyear>=1998
		replace dd =1 if a_incorp=="VA" & a_fyear>=1988
		replace dd =1 if a_incorp=="WI" & a_fyear>=1987
		replace dd =1 if a_incorp=="WY" & a_fyear>=1990

		* pp law
		gen pp=0
		replace pp =1 if a_incorp=="CO" & a_fyear>=1989
		replace pp =1 if a_incorp=="CT" & a_fyear>=2003
		replace pp =1 if a_incorp=="FL" & a_fyear>=1989
		replace pp =1 if a_incorp=="GA" & a_fyear>=1988
		replace pp =1 if a_incorp=="HI" & a_fyear>=1988
		replace pp =1 if a_incorp=="ID" & a_fyear>=1988
		replace pp =1 if a_incorp=="IL" & a_fyear>=1989
		replace pp =1 if a_incorp=="IN" & a_fyear>=1986
		replace pp =1 if a_incorp=="IA" & a_fyear>=1989
		replace pp =1 if a_incorp=="KY" & a_fyear>=1988
		replace pp =1 if a_incorp=="ME" & a_fyear>=2002
		replace pp =1 if a_incorp=="MD" & a_fyear>=1999
		replace pp =1 if a_incorp=="MA" & a_fyear>=1989
		replace pp =1 if a_incorp=="MI" & a_fyear>=2001
		replace pp =1 if a_incorp=="MN" & a_fyear>=1995
		replace pp =1 if a_incorp=="MS" & a_fyear>=2005
		replace pp =1 if a_incorp=="MO" & a_fyear>=1999
		replace pp =1 if a_incorp=="NV" & a_fyear>=1989
		replace pp =1 if a_incorp=="NJ" & a_fyear>=1989
		replace pp =1 if a_incorp=="NY" & a_fyear>=1988
		replace pp =1 if a_incorp=="NC" & a_fyear>=1989
		replace pp =1 if a_incorp=="OH" & a_fyear>=1986
		replace pp =1 if a_incorp=="OR" & a_fyear>=1989
		replace pp =1 if a_incorp=="PA" & a_fyear>=1988
		replace pp =1 if a_incorp=="RI" & a_fyear>=1990
		replace pp =1 if a_incorp=="SC" & a_fyear>=1998
		replace pp =1 if a_incorp=="SD" & a_fyear>=1990
		replace pp =1 if a_incorp=="TN" & a_fyear>=1989
		replace pp =1 if a_incorp=="TX" & a_fyear>=2003
		replace pp =1 if a_incorp=="UT" & a_fyear>=1989
		replace pp =1 if a_incorp=="VT" & a_fyear>=2008
		replace pp =1 if a_incorp=="VA" & a_fyear>=1990
		replace pp =1 if a_incorp=="WA" & a_fyear>=1998
		replace pp =1 if a_incorp=="WI" & a_fyear>=1987
		replace pp =1 if a_incorp=="WY" & a_fyear>=2009

		* Revlon case
		gen revlon=0
		replace revlon =1 if a_incorp=="CA" & a_fyear>=2002
		replace revlon =1 if a_incorp=="DE" & a_fyear>=1986
		replace revlon =1 if a_incorp=="IL" & a_fyear>=1988
		replace revlon =1 if a_incorp=="IN" & a_fyear>=1987
		replace revlon =-1 if a_incorp=="IN" & a_fyear>=2001
		replace revlon =1 if a_incorp=="KS" & a_fyear>=2003
		replace revlon =-1 if a_incorp=="MD" & a_fyear>=2004
		replace revlon =1 if a_incorp=="MD" & a_fyear>=2009
		replace revlon =1 if a_incorp=="MI" & a_fyear>=1986
		replace revlon =1 if a_incorp=="MN" & a_fyear>=1987
		replace revlon =1 if a_incorp=="MO" & a_fyear>=1999
		replace revlon =1 if a_incorp=="NV" & a_fyear>=1997
		replace revlon =-1 if a_incorp=="NV" & a_fyear>=1999
		replace revlon =1 if a_incorp=="NH" & a_fyear>=2001
		replace revlon =1 if a_incorp=="NY" & a_fyear>=1986
		replace revlon =-1 if a_incorp=="NY" & a_fyear>=1997
		replace revlon =-1 if a_incorp=="NC" & a_fyear>=2001
		replace revlon =-1 if a_incorp=="OH" & a_fyear>=1990
		replace revlon =-1 if a_incorp=="PA" & a_fyear>=1987
		replace revlon =-1 if a_incorp=="VA" & a_fyear>=1999
		replace revlon =-1 if a_incorp=="WI" & a_fyear>=1999
		
		* Unocal case
		gen unocal=0
		replace unocal =1 if a_incorp=="AR" & a_fyear>=1993
		replace unocal =1 if a_incorp=="CA" & a_fyear>=1989
		replace unocal =1 if a_incorp=="DE" & a_fyear>=1985
		replace unocal =1 if a_incorp=="CA" & a_fyear>=2002
		replace unocal =1 if a_incorp=="FL" & a_fyear>=1989
		replace unocal =1 if a_incorp=="IL" & a_fyear>=1988
		replace unocal =1 if a_incorp=="IN" & a_fyear>=1987
		replace unocal =-1 if a_incorp=="IN" & a_fyear>=2001
		replace unocal =1 if a_incorp=="KS" & a_fyear>=2003
		replace unocal =-1 if a_incorp=="MD" & a_fyear>=1988
		replace unocal =1 if a_incorp=="MD" & a_fyear>=2004
		replace unocal =-1 if a_incorp=="MA" & a_fyear>=2003
		replace unocal =1 if a_incorp=="MI" & a_fyear>=1986
		replace unocal =1 if a_incorp=="MN" & a_fyear>=1987
		replace unocal =1 if a_incorp=="MO" & a_fyear>=1999
		replace unocal =-1 if a_incorp=="NV" & a_fyear>=1985
		replace unocal =-1 if a_incorp=="NJ" & a_fyear>=1998
		replace unocal =-1 if a_incorp=="NY" & a_fyear>=1986
		replace unocal =-1 if a_incorp=="NC" & a_fyear>=2001
		replace unocal =-1 if a_incorp=="OH" & a_fyear>=1986
		replace unocal =-1 if a_incorp=="PA" & a_fyear>=1986
		replace unocal =1 if a_incorp=="TX" & a_fyear>=1989
		replace unocal =-1 if a_incorp=="VA" & a_fyear>=1995
		replace unocal =1 if a_incorp=="WI" & a_fyear>=1989

		* Blasius case
		gen blasius=0
		replace blasius =1 if a_incorp=="CT" & a_fyear>=2000
		replace blasius =1 if a_incorp=="DE" & a_fyear>=1988
		replace blasius =-1 if a_incorp=="GA" & a_fyear>=1997
		replace blasius =-1 if a_incorp=="IN" & a_fyear>=1993
		replace blasius =-1 if a_incorp=="IN" & a_fyear>=2001
		replace blasius =1 if a_incorp=="KS" & a_fyear>=2003
		replace blasius =-1 if a_incorp=="MD" & a_fyear>=1999
		replace blasius =1 if a_incorp=="MD" & a_fyear>=2005
		replace blasius =1 if a_incorp=="MA" & a_fyear>=1990
		replace blasius =1 if a_incorp=="MI" & a_fyear>=2003
		replace blasius =1 if a_incorp=="NV" & a_fyear>=1997
		replace blasius =-1 if a_incorp=="NV" & a_fyear>=1999
		replace blasius =-1 if a_incorp=="NJ" & a_fyear>=1998
		replace blasius =-1 if a_incorp=="NC" & a_fyear>=1984
		replace blasius =-1 if a_incorp=="OH" & a_fyear>=1986
		replace blasius =-1 if a_incorp=="PA" & a_fyear>=1990
		replace blasius =-1 if a_incorp=="VA" & a_fyear>=1986
		
		* Madaroty classified board law
		gen mcb=0
		replace mcb =1 if a_incorp=="IN" & a_fyear>=2009
		replace mcb =1 if a_incorp=="IA" & a_fyear>=2011
		replace mcb =-1 if a_incorp=="IA" & a_fyear>=2014
		replace mcb =1 if a_incorp=="MA" & a_fyear>=1990
		replace mcb =1 if a_incorp=="OK" & a_fyear>=2010
		replace mcb =-1 if a_incorp=="OK" & a_fyear>=2013

		
********************************
* Table 7 Managerial ownership *
********************************
		
	reghdfe a_car0101_r      a_cow##c.a_ceoownership l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic  , absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	reghdfe a_car0101_neg  a_cow##c.a_ceoownership l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic , absorb(a_state a_ind3d yearad) vce(cluster a_incorp)


*********************************
* Table 8 Independent directors *
*********************************

	reghdfe a_car0101_r      a_cow##c.a_pct_inddir l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic  , absorb(a_stateFE#a_ind3d#a_fyear) vce(cluster a_incorp)
	reghdfe a_car0101_r_neg  a_cow##c.a_pct_inddir l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic , absorb(a_stateFE#a_ind3d#a_fyear) vce(cluster a_incorp)

	
************************************
* Table 10 HQ state = Incorp state *
************************************

	reghdfe a_car0101_r     a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic if a_state==a_incorp, absorb(a_state_yearad a_ind2d_a_fyear) vce(cluster a_incorp)
	reghdfe a_car0101_r_neg  a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic if a_state==a_incorp, absorb(a_state_yearad a_ind2d_a_fyear) vce(cluster a_incorp)

	
**************************	
* Table 11 Drop DE firms *
**************************	

	reghdfe a_car0101_r100     a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic if a_state~="DE", absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	reghdfe a_car0101_r_neg  a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic if a_state~="DE" , absorb(a_state a_ind3d yearad) vce(cluster a_incorp)


*************************************
* Table 12 Additional firm controls *
*************************************

	reghdfe a_car0101_r100     a_cow a_cbdefml a_ceoownership a_div a_busseg a_activeownership5 a_cown_mean l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic , absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	reghdfe a_car0101_r_neg  a_cow a_cbdefml a_ceoownership a_div a_busseg a_activeownership5 a_cown_mean l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic  , absorb(a_state a_ind3d yearad) vce(cluster a_incorp)

	
**************************************
* Table 13 Additional legal controls *
**************************************
	
	reghdfe a_car0101_r100     a_cow nceindex ud mcb cs bc fp dd pp revlon unocal blasius l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic , absorb(a_state_yearad a_ind2d_a_fyear) vce(cluster a_incorp)
	reghdfe a_car0101_r_neg  a_cow nceindex ud mcb cs bc fp dd pp revlon unocal blasius l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic , absorb(a_state a_ind3d yearad) vce(cluster a_incorp)

	
*******************************************	
* Table 14 High dimensional fixed effects *
*******************************************	

	reghdfe a_car0101_r      a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic  , absorb(a_stateFE#a_ind3d#a_fyear) vce(cluster a_incorp)
	reghdfe a_car0101_r_neg  a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic , absorb(a_stateFE#a_ind3d#a_fyear) vce(cluster a_incorp)

	
************************
* Table 15 Matched DiD *
************************
		
		local control "a_ceoownership a_div a_busseg a_activeownership5 a_activeownership a_cown_mean "
		foreach v of local control {
		replace `v'=0 if missing(`v') 
		}
		
		psmatch2 treatment l_a_mktcap a_mb a_lvm a_amihudliq a_roa a_cbdefml a_ceoownership a_activeownership5 a_div a_busseg a_cown_mean i.a_stateFE i.yearad i.a_sic2, n(1)		
		bys a_permno: egen matching_sample = sum(_weight)
	
	reghdfe a_car0101_r100     a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic if matching_sample!=0, absorb(a_state_a_fyear a_ind3d_a_fyear) vce(cluster a_incorp)
	reghdfe a_car0101_r_neg  a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic if matching_sample!=0, absorb(a_state_a_fyear a_ind3d_a_fyear) vce(cluster a_incorp)
	
	
************************
* Table 16 Stacked DiD *
************************

		expand 2, gen(event_DE)
		drop if event_DE==1 & treatment==1 & a_incorp~="DE" 
		drop if event_DE==1 & (ayear<1996 | ayear>2004)

		expand 2 if event_DE==0, gen(event_OK)
		drop if event_OK==1 & treatment==1 & a_incorp~="OK"
		drop if event_OK==1 & (ayear<1997 | ayear>2005)

		expand 2 if event_DE==0 & event_OK==0, gen(event_MO)
		drop if event_MO==1 & treatment==1 & a_incorp~="MO"
		drop if event_MO==1 & (ayear<1999 | ayear>2007)
		
		expand 2 if event_DE==0 & event_OK==0 & event_MO==0, gen(event_KS)
		drop if event_KS==1 & treatment==1 & a_incorp~="KS"
		drop if event_KS==1 & (ayear<2001 | ayear>2009)
		
		expand 2 if event_DE==0 & event_OK==0 & event_MO==0 & event_KS==0, gen(event_TX)
		drop if event_TX==1 & treatment==1 & a_incorp~="TX"
		drop if event_TX==1 & (ayear<2002 | ayear>2010)
		
		expand 2 if event_DE==0 & event_OK==0 & event_MO==0 & event_KS==0 & event_TX==0, gen(event_NV)
		drop if event_NV==1 & treatment==1 & a_incorp~="NV"
		drop if event_NV==1 & (ayear<2003 | ayear>2011)
		
		expand 2 if event_DE==0 & event_OK==0 & event_MO==0 & event_KS==0 & event_TX==0 & event_NV==0, gen(event_NJ)
		drop if event_NJ==1 & treatment==1 & a_incorp~="NJ"
		drop if event_NJ==1 & (ayear<2007 | ayear>2015)
		
		expand 2 if event_DE==0 & event_OK==0 & event_MO==0 & event_KS==0 & event_TX==0 & event_NV==0 & event_NJ==0, gen(event_MD)
		drop if event_MD==1 & treatment==1 & a_incorp~="MD"
		drop if event_MD==1 & (ayear<2010 | ayear>2018) 
		
		expand 2 if event_DE==0 & event_OK==0 & event_MO==0 & event_KS==0 & event_TX==0 & event_NV==0 & event_NJ==0 & event_MD==0, gen(event_WA)
		drop if event_WA==1 & treatment==1 & a_incorp~="WA"
		drop if event_WA==1 & (ayear<2012 | ayear>2020)
		
		drop if event_DE==0 & event_OK==0 & event_MO==0 & event_KS==0 & event_TX==0 & event_NV==0 & event_NJ==0 & event_MD==0 & event_WA==0
		
	reghdfe a_car0101_r100     a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic , absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	reghdfe a_car0101_r    a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic , absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	reghdfe a_car0101_r_neg  a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic , absorb(a_state a_ind3d yearad) vce(cluster a_incorp)

	
	
********************************
* Table B3 Dynamic coeff trend *
********************************
	
	*Initialize variables
	forval x=1/25 {
		gen cown`x'=0
		}

	forval x=0/25 {
		gen cow`x'=0
		}


	gen cow2p = 0
	gen cow3p = 0
	gen cow4p = 0

	*Generate event time dummies
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
		forval x=1/25 {
		replace cown`x' = 1 if a_incorp == "`state'" & ayear == year(``state'_cow')-`x'
		}
		}	
		
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
		forval x=0/25 {
		replace cow`x' = 1 if a_incorp == "`state'" & ayear == year(``state'_cow')+`x'
		}
		}
		
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
		replace cow2p = 1 if a_incorp == "`state'" & ayear >= year(``state'_cow')+2
		replace cow3p = 1 if a_incorp == "`state'" & ayear >= year(``state'_cow')+3
		replace cow4p = 1 if a_incorp == "`state'" & ayear >= year(``state'_cow')+4
		}

	*Generate interaction terms (Xcar) 
	forval x=1/25 {
		gen cown`x'Xcar = cown`x'*a_car0101_r
		}

	forval x=0/25 {
		gen cow`x'Xcar = cow`x'*a_car0101_r
		}

	gen cow2pXcar = cow2p*a_car0101_r
	gen cow3pXcar = cow3p*a_car0101_r
	gen cow4pXcar = cow4p*a_car0101_r

	reghdfe a_car0101_r     l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic  cown2 cown1 cow0 cow1 cow2 cow3p , absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	reghdfe a_car0101_r_neg   l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic cown2 cown1 cow0 cow1 cow2 cow3p, absorb(a_state a_ind3d yearad) vce(cluster a_incorp)

	
	
*******************************
* Figure B2 Block permutation *
*******************************
	
	use "C:\cow\ma.dta",clear
	drop if a_fyear<1996
	drop if missing(a_state)
	drop if missing(a_incorp)
	drop if inlist(a_incorp, "AS", "INTL", "PR", "TT", "VI")
	drop if missing(l_a_mktcap, a_q, a_lvb, a_amihudliq, a_roa, rel_size, d_t_private, d_t_sub ,d_allcash, d_tender, d_hostile, d_compete, d_toehold, d_lockup, d_moe, d_same2sic)

	forval y= 1/1000 {
	bysort incorp_no: gen ryear_`y' = runiformint(1996,2018)
	bysort incorp_no: replace ryear_`y' = ryear_`y'[1]
	bysort incorp_no: gen treatment_`y' = runiformint(0,1)
	bysort incorp_no: replace treatment_`y' = treatment_`y'[1]
	gen cow_`y' =0
	replace cow_`y' =1 if treatment_`y'==1 & a_fyear >= ryear_`y'
	quietly reghdfe a_car0101_r cow_`y' l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic  , absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	estimate store m`y'
	drop ryear_`y' treatment_`y' cow_`y'
	}
	estout m* using "car_loop1.csv", cells(b) replace


	use "C:\cow\ma.dta",clear
	drop if a_fyear<1996
	drop if missing(a_state)
	drop if missing(a_incorp)
	drop if inlist(a_incorp, "AS", "INTL", "PR", "TT", "VI")
	drop if missing(l_a_mktcap, a_q, a_lvb, a_amihudliq, a_roa, rel_size, d_t_private, d_t_sub ,d_allcash, d_tender, d_hostile, d_compete, d_toehold, d_lockup, d_moe, d_same2sic)

	forval y= 1/1000 {
	bysort incorp_no: gen ryear_`y' = runiformint(1996,2018)
	bysort incorp_no: replace ryear_`y' = ryear_`y'[1]
	bysort incorp_no: gen treatment_`y' = runiformint(0,1)
	bysort incorp_no: replace treatment_`y' = treatment_`y'[1]
	gen cow_`y' =0
	replace cow_`y' =1 if treatment_`y'==1 & a_fyear >= ryear_`y'
	quietly reghdfe a_car0101_r_neg cow_`y' l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic , absorb(a_state a_ind3d yearad) vce(cluster a_incorp)
	estimate store m`y'
	drop ryear_`y' treatment_`y' cow_`y'
	}
	estout m* using "car_neg_loop1.csv", cells(b) replace

	
	
	
	
	
	
	
	
	
	
	
	
*****************************************;	
* Model 3 Probability of deal withdrawal ;	
*****************************************;

	use "C:\cow\ma.dta",clear
	drop if a_fyear<1996
	drop if a_sic >= 4900 & a_sic <= 4999
	drop if a_sic >= 9000 & a_sic <= 9999
	encode a_cusip, gen(a_cusipFE)
	encode a_state, gen(a_stateFE)
	encode t_incorp, gen(t_incorpFE)	
	drop if missing(a_state)
	drop if missing(a_incorp)
	drop if inlist(a_incorp, "AS", "INTL", "PR", "TT", "VI")
	drop if missing(l_a_mktcap, a_q, a_lvb, a_amihudliq, a_roa, rel_size, d_t_private, d_t_sub ,d_allcash, d_tender, d_hostile, d_compete, d_toehold, d_lockup, d_moe, d_same2sic)

	local statelist "DE OK MO KS TX NV NJ MD WA"
	gen treatment = 0
	foreach state of local statelist {
			replace treatment = 1 if a_incorp == "`state'"
	}

	
	
	*Create macros for date when law was passed
	local DE_cow = date("01Jul2000","DMY")
	local OK_cow = date("01Nov2001","DMY")
	local MO_cow = date("01Oct2003","DMY")
	local KS_cow = date("01Jan2005","DMY")
	local TX_cow = date("01Jan2006","DMY")
	local NV_cow = date("01Oct2007","DMY")
	local NJ_cow = date("11Mar2011","DMY")
	local MD_cow = date("01Oct2014","DMY")
	local WA_cow = date("01Jan2016","DMY")
	

	* adjust calendar year of fyeendt to be next year if fyenddt month < cow law date
	gen ayear = year(a_fyenddt)
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
			replace ayear = year(a_fyenddt)-1 if a_incorp == "`state'" & month(a_fyenddt) < month(``state'_cow')
			}

	*cow: indicator equal to one if acquirer is incorporated in a state that has passed a COW law
	gen a_cow = 0
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
			replace a_cow = 1 if a_incorp == "`state'" & ayear >= year(``state'_cow')
			}

	*Create macros for date when law was passed
	local DE_cow = date("01Jul2000","DMY")
	local OK_cow = date("01Nov2001","DMY")
	local MO_cow = date("01Oct2003","DMY")
	local KS_cow = date("01Jan2005","DMY")
	local TX_cow = date("01Jan2006","DMY")
	local NV_cow = date("01Oct2007","DMY")
	local NJ_cow = date("11Mar2011","DMY")
	local MD_cow = date("01Oct2014","DMY")
	local WA_cow = date("01Jan2016","DMY")

	* adjust calendar year of fyeendt to be next year if fyenddt month < cow law date
	gen tyear = year(t_fyenddt)
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
			replace tyear = year(t_fyenddt)-1 if t_incorp == "`state'" & month(t_fyenddt) < month(``state'_cow')
			}
	*cow: indicator equal to one if target is incorporated in a state that has passed a COW law
	gen tgt_cow = 0
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
			replace tgt_cow = 1 if t_incorp == "`state'" & tyear >= year(``state'_cow')
			}

			
*******************************
* Table 6 Panel B Regressions *
*******************************

	gen d_withdrawn = 1-d_complete
	gen a_cow_a_car0101_r=a_cow*a_car0101_r
	gen a_cow_a_car0101=a_cow*a_car0101
	gen a_car0101_r100=a_car0101_r*100
	gen a_cow_a_car0101_r100=a_cow*a_car0101_r100

	
	reghdfe d_withdrawn a_cow a_car0101_r a_cow_a_car0101_r  l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic, absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	
	reghdfe d_withdrawn  a_cow a_car0101_r a_cow_a_car0101_r l_a_mktcap a_mb a_lvm a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic, absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)

	reghdfe d_withdrawn a_cow  a_car0101_r a_cow_a_car0101  l_a_mktcap a_mb a_lvm a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic, absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	

	
	
	
	
	
*======================================*
*           ROBUSTNESS TESTS	       *
*======================================*
	
		* noncompete index		
		gen nceindex=0
		replace nceindex=5 if a_incorp=="AL"
		replace nceindex=3 if a_incorp=="AK"
		replace nceindex=3 if a_incorp=="AZ"
		replace nceindex=5 if a_incorp=="AR"
		replace nceindex=0 if a_incorp=="CA"
		replace nceindex=1 if a_incorp=="CO"
		replace nceindex=2 if a_incorp=="CO" & a_fyear>=1992 
		replace nceindex=3 if a_incorp=="CO" & a_fyear>=2012 
		replace nceindex=4 if a_incorp=="CT"
		replace nceindex=3 if a_incorp=="CT" & a_fyear>=1992
		replace nceindex=6 if a_incorp=="DE"
		replace nceindex=7 if a_incorp=="DC"
		replace nceindex=7 if a_incorp=="FL"
		replace nceindex=9 if a_incorp=="FL" & a_fyear>=1997
		replace nceindex=5 if a_incorp=="GA"
		replace nceindex=6 if a_incorp=="GA" & a_fyear>=2005
		replace nceindex=7 if a_incorp=="GA" & a_fyear>=2011
		replace nceindex=3 if a_incorp=="HI"
		replace nceindex=4 if a_incorp=="HI" & a_fyear>=2007
		replace nceindex=5 if a_incorp=="ID"
		replace nceindex=6 if a_incorp=="ID" & a_fyear>=1992
		replace nceindex=7 if a_incorp=="ID" & a_fyear>=2009
		replace nceindex=5 if a_incorp=="IL"
		replace nceindex=6 if a_incorp=="IL" & (2012<=a_fyear<=2013) 
		replace nceindex=5 if a_incorp=="IN"
		replace nceindex=6 if a_incorp=="IA"
		replace nceindex=6 if a_incorp=="KS"
		replace nceindex=7 if a_incorp=="KS" & a_fyear>=2008
		replace nceindex=6 if a_incorp=="KY"
		replace nceindex=5 if a_incorp=="KY" & a_fyear>=2015
		replace nceindex=2 if a_incorp=="LA" & a_fyear<=1991
		replace nceindex=4 if a_incorp=="LA" & (1992<=a_fyear<=2001)
		replace nceindex=4 if a_incorp=="LA" & (2004<=a_fyear)
		replace nceindex=4 if a_incorp=="ME"
		replace nceindex=5 if a_incorp=="MD"
		replace nceindex=6 if a_incorp=="MA"
		replace nceindex=5 if a_incorp=="MI"
		replace nceindex=5 if a_incorp=="MN"
		replace nceindex=4 if a_incorp=="MS"
		replace nceindex=5 if a_incorp=="MS" & a_fyear>=2009
		replace nceindex=7 if a_incorp=="MO"
		replace nceindex=2 if a_incorp=="MT"
		replace nceindex=4 if a_incorp=="NE"
		replace nceindex=5 if a_incorp=="NV"
		replace nceindex=2 if a_incorp=="NH"
		replace nceindex=1 if a_incorp=="NH" & a_fyear>=2013
		replace nceindex=4 if a_incorp=="NJ"
		replace nceindex=2 if a_incorp=="NM"
		replace nceindex=3 if a_incorp=="NY"
		replace nceindex=4 if a_incorp=="NC"
		replace nceindex=0 if a_incorp=="ND"
		replace nceindex=4 if a_incorp=="OH"
		replace nceindex=5 if a_incorp=="OH" & a_fyear>=1992
		replace nceindex=6 if a_incorp=="OH" & a_fyear>=2005
		replace nceindex=1 if a_incorp=="OK"
		replace nceindex=6 if a_incorp=="OR"
		replace nceindex=5 if a_incorp=="OR" & a_fyear>=2008
		replace nceindex=6 if a_incorp=="PA"
		replace nceindex=3 if a_incorp=="RI"
		replace nceindex=5 if a_incorp=="SC"
		replace nceindex=4 if a_incorp=="SC" & a_fyear>=2011
		replace nceindex=5 if a_incorp=="SD"
		replace nceindex=7 if a_incorp=="TN"
		replace nceindex=5 if a_incorp=="TX"
		replace nceindex=3 if a_incorp=="TX" & a_fyear>=1995
		replace nceindex=4 if a_incorp=="TX" & a_fyear>=2011
		replace nceindex=6 if a_incorp=="UT"
		replace nceindex=5 if a_incorp=="VT"
		replace nceindex=6 if a_incorp=="VT" & a_fyear>=2006
		replace nceindex=4 if a_incorp=="VA" & (1980<=a_fyear<=1991)
		replace nceindex=3 if a_incorp=="VA" & (1992<=a_fyear<=2005)
		replace nceindex=4 if a_incorp=="VA" & (2006<=a_fyear<=2013)
		replace nceindex=5 if a_incorp=="VA" & (2014<=a_fyear)
		replace nceindex=5 if a_incorp=="WA"
		replace nceindex=2 if a_incorp=="WV" 
		replace nceindex=3 if a_incorp=="WV" & (1984<=a_fyear<=1991)
		replace nceindex=3 if a_incorp=="WI"
		replace nceindex=4 if a_incorp=="WI" & a_fyear>=2010
		replace nceindex=5 if a_incorp=="WI" & a_fyear>=2016
		replace nceindex=4 if a_incorp=="WY"

		* universal demand law
		gen ud=0
		replace ud=1 if a_incorp=="UT" & a_fyear>=1992
		replace ud=1 if a_incorp=="NH" & a_fyear>=1993
		replace ud=1 if a_incorp=="MS" & a_fyear>=1993
		replace ud=1 if a_incorp=="NC" & a_fyear>=1995
		replace ud=1 if a_incorp=="AZ" & a_fyear>=1996
		replace ud=1 if a_incorp=="NE" & a_fyear>=1996
		replace ud=1 if a_incorp=="CT" & a_fyear>=1997
		replace ud=1 if a_incorp=="ME" & a_fyear>=1997
		replace ud=1 if a_incorp=="PA" & a_fyear>=1997
		replace ud=1 if a_incorp=="TX" & a_fyear>=1997
		replace ud=1 if a_incorp=="WY" & a_fyear>=1997
		replace ud=1 if a_incorp=="ID" & a_fyear>=1998
		replace ud=1 if a_incorp=="HI" & a_fyear>=2001
		replace ud=1 if a_incorp=="IA" & a_fyear>=2003
		replace ud=1 if a_incorp=="MA" & a_fyear>=2004
		replace ud=1 if a_incorp=="RI" & a_fyear>=2005
		replace ud=1 if a_incorp=="SD" & a_fyear>=2005
		
		* The five most common types of antitakeover laws adopted by states since 1982. The law types are: control share acquisition laws (CS), business combination laws (BC), fair price laws (FP), directors' duties laws (DD), and poison pill laws (PP)
 
		* cs law
		gen cs=0
		replace cs =1 if a_incorp=="AZ" & a_fyear>=1987
		replace cs =1 if a_incorp=="FL" & a_fyear>=1987
		replace cs =1 if a_incorp=="HI" & a_fyear>=1985
		replace cs =1 if a_incorp=="ID" & a_fyear>=1988
		replace cs =1 if a_incorp=="IN" & a_fyear>=1986
		replace cs =1 if a_incorp=="KS" & a_fyear>=1988
		replace cs =1 if a_incorp=="LA" & a_fyear>=1987
		replace cs =1 if a_incorp=="MD" & a_fyear>=1989
		replace cs =1 if a_incorp=="MA" & a_fyear>=1987
		replace cs =1 if a_incorp=="MI" & a_fyear>=1988
		replace cs =1 if a_incorp=="MN" & a_fyear>=1984
		replace cs =1 if a_incorp=="MS" & a_fyear>=1990
		replace cs =1 if a_incorp=="MO" & a_fyear>=1984
		replace cs =1 if a_incorp=="NE" & a_fyear>=1988
		replace cs =1 if a_incorp=="NV" & a_fyear>=1987
		replace cs =1 if a_incorp=="NC" & a_fyear>=1987
		replace cs =1 if a_incorp=="OH" & a_fyear>=1982
		replace cs =1 if a_incorp=="OK" & a_fyear>=1987
		replace cs =1 if a_incorp=="OR" & a_fyear>=1987
		replace cs =1 if a_incorp=="PA" & a_fyear>=1990
		replace cs =1 if a_incorp=="SC" & a_fyear>=1988
		replace cs =1 if a_incorp=="SD" & a_fyear>=1990
		replace cs =1 if a_incorp=="TN" & a_fyear>=1988
		replace cs =1 if a_incorp=="UT" & a_fyear>=1987
		replace cs =1 if a_incorp=="VA" & a_fyear>=1989
		replace cs =1 if a_incorp=="WI" & a_fyear>=1984
		replace cs =1 if a_incorp=="WY" & a_fyear>=1990

		* bc law
		gen bc=0
		replace bc =1 if a_incorp=="AZ" & a_fyear>=1987
		replace bc =1 if a_incorp=="CT" & a_fyear>=1988
		replace bc =1 if a_incorp=="DE" & a_fyear>=1988
		replace bc =1 if a_incorp=="GA" & a_fyear>=1988
		replace bc =1 if a_incorp=="ID" & a_fyear>=1988
		replace bc =1 if a_incorp=="IL" & a_fyear>=1989
		replace bc =1 if a_incorp=="IN" & a_fyear>=1986
		replace bc =1 if a_incorp=="IA" & a_fyear>=1997
		replace bc =1 if a_incorp=="KS" & a_fyear>=1989
		replace bc =1 if a_incorp=="KY" & a_fyear>=1986
		replace bc =1 if a_incorp=="ME" & a_fyear>=1988
		replace bc =1 if a_incorp=="MD" & a_fyear>=1989
		replace bc =1 if a_incorp=="MA" & a_fyear>=1989
		replace bc =1 if a_incorp=="MI" & a_fyear>=1989
		replace bc =1 if a_incorp=="MN" & a_fyear>=1987
		replace bc =1 if a_incorp=="MO" & a_fyear>=1986
		replace bc =1 if a_incorp=="NE" & a_fyear>=1988
		replace bc =1 if a_incorp=="NV" & a_fyear>=1991
		replace bc =1 if a_incorp=="NJ" & a_fyear>=1986
		replace bc =1 if a_incorp=="NY" & a_fyear>=1985
		replace bc =1 if a_incorp=="OH" & a_fyear>=1990
		replace bc =1 if a_incorp=="OK" & a_fyear>=1991
		replace bc =1 if a_incorp=="OR" & a_fyear>=1991
		replace bc =1 if a_incorp=="PA" & a_fyear>=1988
		replace bc =1 if a_incorp=="RI" & a_fyear>=1990
		replace bc =1 if a_incorp=="SC" & a_fyear>=1988
		replace bc =1 if a_incorp=="SD" & a_fyear>=1990
		replace bc =1 if a_incorp=="TN" & a_fyear>=1988
		replace bc =1 if a_incorp=="TX" & a_fyear>=1997
		replace bc =1 if a_incorp=="VA" & a_fyear>=1988
		replace bc =1 if a_incorp=="WA" & a_fyear>=1987
		replace bc =1 if a_incorp=="WI" & a_fyear>=1987
		replace bc =1 if a_incorp=="WY" & a_fyear>=1989

		* fp law
		gen fp=0
		replace fp =1 if a_incorp=="AZ" & a_fyear>=1987
		replace fp =1 if a_incorp=="CT" & a_fyear>=1984
		replace fp =1 if a_incorp=="FL" & a_fyear>=1987
		replace fp =1 if a_incorp=="GA" & a_fyear>=1985
		replace fp =1 if a_incorp=="ID" & a_fyear>=1988
		replace fp =1 if a_incorp=="IL" & a_fyear>=1985
		replace fp =1 if a_incorp=="IN" & a_fyear>=1986
		replace fp =1 if a_incorp=="KY" & a_fyear>=1984
		replace fp =1 if a_incorp=="LA" & a_fyear>=1984
		replace fp =1 if a_incorp=="MD" & a_fyear>=1983
		replace fp =1 if a_incorp=="MI" & a_fyear>=1984
		replace fp =1 if a_incorp=="MN" & a_fyear>=1991
		replace fp =1 if a_incorp=="MS" & a_fyear>=1985
		replace fp =1 if a_incorp=="MO" & a_fyear>=1986
		replace fp =1 if a_incorp=="NV" & a_fyear>=1991
		replace fp =1 if a_incorp=="NJ" & a_fyear>=1986
		replace fp =1 if a_incorp=="NY" & a_fyear>=1985
		replace fp =1 if a_incorp=="NC" & a_fyear>=1987
		replace fp =1 if a_incorp=="OH" & a_fyear>=1990
		replace fp =1 if a_incorp=="PA" & a_fyear>=1988
		replace fp =1 if a_incorp=="RI" & a_fyear>=1990
		replace fp =1 if a_incorp=="SC" & a_fyear>=1988
		replace fp =1 if a_incorp=="SD" & a_fyear>=1990
		replace fp =1 if a_incorp=="TN" & a_fyear>=1988
		replace fp =1 if a_incorp=="VA" & a_fyear>=1985
		replace fp =1 if a_incorp=="WA" & a_fyear>=1985
		replace fp =1 if a_incorp=="WI" & a_fyear>=1984

		* dd law
		gen dd=0
		replace dd =1 if a_incorp=="AZ" & a_fyear>=1987
		replace dd =1 if a_incorp=="CT" & a_fyear>=1988
		replace dd =1 if a_incorp=="FL" & a_fyear>=1989
		replace dd =1 if a_incorp=="GA" & a_fyear>=1989
		replace dd =1 if a_incorp=="HI" & a_fyear>=1989
		replace dd =1 if a_incorp=="ID" & a_fyear>=1988
		replace dd =1 if a_incorp=="IL" & a_fyear>=1985
		replace dd =1 if a_incorp=="IN" & a_fyear>=1986
		replace dd =1 if a_incorp=="IA" & a_fyear>=1989
		replace dd =1 if a_incorp=="KY" & a_fyear>=1988
		replace dd =1 if a_incorp=="LA" & a_fyear>=1988
		replace dd =1 if a_incorp=="ME" & a_fyear>=1985
		replace dd =1 if a_incorp=="MD" & a_fyear>=1999
		replace dd =1 if a_incorp=="MA" & a_fyear>=1989
		replace dd =1 if a_incorp=="MN" & a_fyear>=1987
		replace dd =1 if a_incorp=="MS" & a_fyear>=1990
		replace dd =1 if a_incorp=="MO" & a_fyear>=1986
		replace dd =1 if a_incorp=="NE" & a_fyear>=1988
		replace dd =1 if a_incorp=="NV" & a_fyear>=1991
		replace dd =1 if a_incorp=="NJ" & a_fyear>=1989
		replace dd =1 if a_incorp=="NM" & a_fyear>=1987
		replace dd =1 if a_incorp=="NY" & a_fyear>=1987
		replace dd =1 if a_incorp=="NC" & a_fyear>=1993
		replace dd =1 if a_incorp=="ND" & a_fyear>=1993
		replace dd =1 if a_incorp=="OH" & a_fyear>=1984
		replace dd =1 if a_incorp=="OR" & a_fyear>=1989
		replace dd =1 if a_incorp=="PA" & a_fyear>=1990
		replace dd =1 if a_incorp=="RI" & a_fyear>=1990
		replace dd =1 if a_incorp=="SD" & a_fyear>=1990
		replace dd =1 if a_incorp=="TN" & a_fyear>=1988
		replace dd =1 if a_incorp=="TX" & a_fyear>=2003
		replace dd =1 if a_incorp=="VT" & a_fyear>=1998
		replace dd =1 if a_incorp=="VA" & a_fyear>=1988
		replace dd =1 if a_incorp=="WI" & a_fyear>=1987
		replace dd =1 if a_incorp=="WY" & a_fyear>=1990

		* pp law
		gen pp=0
		replace pp =1 if a_incorp=="CO" & a_fyear>=1989
		replace pp =1 if a_incorp=="CT" & a_fyear>=2003
		replace pp =1 if a_incorp=="FL" & a_fyear>=1989
		replace pp =1 if a_incorp=="GA" & a_fyear>=1988
		replace pp =1 if a_incorp=="HI" & a_fyear>=1988
		replace pp =1 if a_incorp=="ID" & a_fyear>=1988
		replace pp =1 if a_incorp=="IL" & a_fyear>=1989
		replace pp =1 if a_incorp=="IN" & a_fyear>=1986
		replace pp =1 if a_incorp=="IA" & a_fyear>=1989
		replace pp =1 if a_incorp=="KY" & a_fyear>=1988
		replace pp =1 if a_incorp=="ME" & a_fyear>=2002
		replace pp =1 if a_incorp=="MD" & a_fyear>=1999
		replace pp =1 if a_incorp=="MA" & a_fyear>=1989
		replace pp =1 if a_incorp=="MI" & a_fyear>=2001
		replace pp =1 if a_incorp=="MN" & a_fyear>=1995
		replace pp =1 if a_incorp=="MS" & a_fyear>=2005
		replace pp =1 if a_incorp=="MO" & a_fyear>=1999
		replace pp =1 if a_incorp=="NV" & a_fyear>=1989
		replace pp =1 if a_incorp=="NJ" & a_fyear>=1989
		replace pp =1 if a_incorp=="NY" & a_fyear>=1988
		replace pp =1 if a_incorp=="NC" & a_fyear>=1989
		replace pp =1 if a_incorp=="OH" & a_fyear>=1986
		replace pp =1 if a_incorp=="OR" & a_fyear>=1989
		replace pp =1 if a_incorp=="PA" & a_fyear>=1988
		replace pp =1 if a_incorp=="RI" & a_fyear>=1990
		replace pp =1 if a_incorp=="SC" & a_fyear>=1998
		replace pp =1 if a_incorp=="SD" & a_fyear>=1990
		replace pp =1 if a_incorp=="TN" & a_fyear>=1989
		replace pp =1 if a_incorp=="TX" & a_fyear>=2003
		replace pp =1 if a_incorp=="UT" & a_fyear>=1989
		replace pp =1 if a_incorp=="VT" & a_fyear>=2008
		replace pp =1 if a_incorp=="VA" & a_fyear>=1990
		replace pp =1 if a_incorp=="WA" & a_fyear>=1998
		replace pp =1 if a_incorp=="WI" & a_fyear>=1987
		replace pp =1 if a_incorp=="WY" & a_fyear>=2009

		* Revlon case
		gen revlon=0
		replace revlon =1 if a_incorp=="CA" & a_fyear>=2002
		replace revlon =1 if a_incorp=="DE" & a_fyear>=1986
		replace revlon =1 if a_incorp=="IL" & a_fyear>=1988
		replace revlon =1 if a_incorp=="IN" & a_fyear>=1987
		replace revlon =-1 if a_incorp=="IN" & a_fyear>=2001
		replace revlon =1 if a_incorp=="KS" & a_fyear>=2003
		replace revlon =-1 if a_incorp=="MD" & a_fyear>=2004
		replace revlon =1 if a_incorp=="MD" & a_fyear>=2009
		replace revlon =1 if a_incorp=="MI" & a_fyear>=1986
		replace revlon =1 if a_incorp=="MN" & a_fyear>=1987
		replace revlon =1 if a_incorp=="MO" & a_fyear>=1999
		replace revlon =1 if a_incorp=="NV" & a_fyear>=1997
		replace revlon =-1 if a_incorp=="NV" & a_fyear>=1999
		replace revlon =1 if a_incorp=="NH" & a_fyear>=2001
		replace revlon =1 if a_incorp=="NY" & a_fyear>=1986
		replace revlon =-1 if a_incorp=="NY" & a_fyear>=1997
		replace revlon =-1 if a_incorp=="NC" & a_fyear>=2001
		replace revlon =-1 if a_incorp=="OH" & a_fyear>=1990
		replace revlon =-1 if a_incorp=="PA" & a_fyear>=1987
		replace revlon =-1 if a_incorp=="VA" & a_fyear>=1999
		replace revlon =-1 if a_incorp=="WI" & a_fyear>=1999
		
		* Unocal case
		gen unocal=0
		replace unocal =1 if a_incorp=="AR" & a_fyear>=1993
		replace unocal =1 if a_incorp=="CA" & a_fyear>=1989
		replace unocal =1 if a_incorp=="DE" & a_fyear>=1985
		replace unocal =1 if a_incorp=="CA" & a_fyear>=2002
		replace unocal =1 if a_incorp=="FL" & a_fyear>=1989
		replace unocal =1 if a_incorp=="IL" & a_fyear>=1988
		replace unocal =1 if a_incorp=="IN" & a_fyear>=1987
		replace unocal =-1 if a_incorp=="IN" & a_fyear>=2001
		replace unocal =1 if a_incorp=="KS" & a_fyear>=2003
		replace unocal =-1 if a_incorp=="MD" & a_fyear>=1988
		replace unocal =1 if a_incorp=="MD" & a_fyear>=2004
		replace unocal =-1 if a_incorp=="MA" & a_fyear>=2003
		replace unocal =1 if a_incorp=="MI" & a_fyear>=1986
		replace unocal =1 if a_incorp=="MN" & a_fyear>=1987
		replace unocal =1 if a_incorp=="MO" & a_fyear>=1999
		replace unocal =-1 if a_incorp=="NV" & a_fyear>=1985
		replace unocal =-1 if a_incorp=="NJ" & a_fyear>=1998
		replace unocal =-1 if a_incorp=="NY" & a_fyear>=1986
		replace unocal =-1 if a_incorp=="NC" & a_fyear>=2001
		replace unocal =-1 if a_incorp=="OH" & a_fyear>=1986
		replace unocal =-1 if a_incorp=="PA" & a_fyear>=1986
		replace unocal =1 if a_incorp=="TX" & a_fyear>=1989
		replace unocal =-1 if a_incorp=="VA" & a_fyear>=1995
		replace unocal =1 if a_incorp=="WI" & a_fyear>=1989

		* Blasius case
		gen blasius=0
		replace blasius =1 if a_incorp=="CT" & a_fyear>=2000
		replace blasius =1 if a_incorp=="DE" & a_fyear>=1988
		replace blasius =-1 if a_incorp=="GA" & a_fyear>=1997
		replace blasius =-1 if a_incorp=="IN" & a_fyear>=1993
		replace blasius =-1 if a_incorp=="IN" & a_fyear>=2001
		replace blasius =1 if a_incorp=="KS" & a_fyear>=2003
		replace blasius =-1 if a_incorp=="MD" & a_fyear>=1999
		replace blasius =1 if a_incorp=="MD" & a_fyear>=2005
		replace blasius =1 if a_incorp=="MA" & a_fyear>=1990
		replace blasius =1 if a_incorp=="MI" & a_fyear>=2003
		replace blasius =1 if a_incorp=="NV" & a_fyear>=1997
		replace blasius =-1 if a_incorp=="NV" & a_fyear>=1999
		replace blasius =-1 if a_incorp=="NJ" & a_fyear>=1998
		replace blasius =-1 if a_incorp=="NC" & a_fyear>=1984
		replace blasius =-1 if a_incorp=="OH" & a_fyear>=1986
		replace blasius =-1 if a_incorp=="PA" & a_fyear>=1990
		replace blasius =-1 if a_incorp=="VA" & a_fyear>=1986
		
		* Madaroty classified board law
		gen mcb=0
		replace mcb =1 if a_incorp=="IN" & a_fyear>=2009
		replace mcb =1 if a_incorp=="IA" & a_fyear>=2011
		replace mcb =-1 if a_incorp=="IA" & a_fyear>=2014
		replace mcb =1 if a_incorp=="MA" & a_fyear>=1990
		replace mcb =1 if a_incorp=="OK" & a_fyear>=2010
		replace mcb =-1 if a_incorp=="OK" & a_fyear>=2013

		
********************************
* Table 7 Managerial ownership *
********************************
				
	reghdfe d_withdrawn   c.a_car0101##c.a_ceoownership c.a_cow_a_car0101##c.a_ceoownership a_cow##c.a_ceoownership l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic, absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	

*********************************
* Table 8 Independent directors *
*********************************
	
	reghdfe d_withdrawn   a_cow##c.a_pct_inddir##c.a_car0101_r l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic, absorb(a_stateFE#a_fyear a_ind2d#yearad) vce(cluster a_incorp)

		
************************************
* Table 10 HQ state = Incorp state *
************************************

	reghdfe d_withdrawn  l_a_assets a_mb a_lvm a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile  d_toehold d_lockup d_moe d_same2sic a_cow a_car0101_r a_cow_a_car0101_r if a_incorp==a_state  , absorb(yearad a_ind2d#a_fyear) vce(cluster a_incorp)


**************************	
* Table 11 Drop DE firms *
**************************	

	reghdfe d_withdrawn  a_cow a_car0101_r a_cow_a_car0101_r  l_a_mktcap a_mb a_lvm a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic if a_state~="DE", absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	

*************************************
* Table 12 Additional firm controls *
*************************************

		local control "a_cbdefml a_ceoownership a_div a_busseg a_activeownership5  "
		foreach v of local control {
		replace `v'=0 if missing(`v') 
		}

	reghdfe d_withdrawn  a_cow a_car0101_r a_cow_a_car0101_r  a_cbdefml a_ceoownership a_div a_busseg a_activeownership5 a_cown_mean l_a_mktcap a_mb a_lvm a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic, absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)

	
**************************************
* Table 13 Additional legal controls *
**************************************
	
	reghdfe d_withdrawn  a_cow a_car0101_r a_cow_a_car0101_r  nceindex ud mcb cs bc fp dd pp revlon unocal blasius l_a_mktcap a_mb a_lvm a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic, absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)

	
*******************************************	
* Table 14 High dimensional fixed effects *
*******************************************	

	reghdfe d_withdrawn a_cow a_car0101_r a_cow_a_car0101  l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic, absorb(a_stateFE#a_ind2d#a_fyear) vce(cluster a_incorp )

	
************************
* Table 15 Matched DiD *
************************
		
		local control "a_ceoownership a_div a_busseg a_activeownership5 a_activeownership a_cown_mean "
		foreach v of local control {
		replace `v'=0 if missing(`v') 
		}
		
		psmatch2 treatment l_a_mktcap a_mb a_lvm a_amihudliq a_roa a_cbdefml a_ceoownership a_activeownership5 a_div a_busseg a_cown_mean i.a_stateFE i.yearad i.a_sic2, n(1)		
		bys a_permno: egen matching_sample = sum(_weight)
	reghdfe d_withdrawn a_cow a_car0101_r a_cow_a_car0101_r  l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic if matching_sample!=0, absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	
	
************************
* Table 16 Stacked DiD *
************************

		expand 2, gen(event_DE)
		drop if event_DE==1 & treatment==1 & a_incorp~="DE" 
		drop if event_DE==1 & (ayear<1996 | ayear>2004)

		expand 2 if event_DE==0, gen(event_OK)
		drop if event_OK==1 & treatment==1 & a_incorp~="OK"
		drop if event_OK==1 & (ayear<1997 | ayear>2005)

		expand 2 if event_DE==0 & event_OK==0, gen(event_MO)
		drop if event_MO==1 & treatment==1 & a_incorp~="MO"
		drop if event_MO==1 & (ayear<1999 | ayear>2007)
		
		expand 2 if event_DE==0 & event_OK==0 & event_MO==0, gen(event_KS)
		drop if event_KS==1 & treatment==1 & a_incorp~="KS"
		drop if event_KS==1 & (ayear<2001 | ayear>2009)
		
		expand 2 if event_DE==0 & event_OK==0 & event_MO==0 & event_KS==0, gen(event_TX)
		drop if event_TX==1 & treatment==1 & a_incorp~="TX"
		drop if event_TX==1 & (ayear<2002 | ayear>2010)
		
		expand 2 if event_DE==0 & event_OK==0 & event_MO==0 & event_KS==0 & event_TX==0, gen(event_NV)
		drop if event_NV==1 & treatment==1 & a_incorp~="NV"
		drop if event_NV==1 & (ayear<2003 | ayear>2011)
		
		expand 2 if event_DE==0 & event_OK==0 & event_MO==0 & event_KS==0 & event_TX==0 & event_NV==0, gen(event_NJ)
		drop if event_NJ==1 & treatment==1 & a_incorp~="NJ"
		drop if event_NJ==1 & (ayear<2007 | ayear>2015)
		
		expand 2 if event_DE==0 & event_OK==0 & event_MO==0 & event_KS==0 & event_TX==0 & event_NV==0 & event_NJ==0, gen(event_MD)
		drop if event_MD==1 & treatment==1 & a_incorp~="MD"
		drop if event_MD==1 & (ayear<2010 | ayear>2018) 
		
		expand 2 if event_DE==0 & event_OK==0 & event_MO==0 & event_KS==0 & event_TX==0 & event_NV==0 & event_NJ==0 & event_MD==0, gen(event_WA)
		drop if event_WA==1 & treatment==1 & a_incorp~="WA"
		drop if event_WA==1 & (ayear<2012 | ayear>2020)
		
		drop if event_DE==0 & event_OK==0 & event_MO==0 & event_KS==0 & event_TX==0 & event_NV==0 & event_NJ==0 & event_MD==0 & event_WA==0
		
	reghdfe d_withdrawn a_cow a_car0101_r a_cow_a_car0101_r  l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile  d_toehold d_lockup d_moe d_same2sic, absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	
		
	
********************************
* Table B3 Dynamic coeff trend *
********************************

	*Initialize variables
	forval x=1/25 {
		gen cown`x'=0
		}

	forval x=0/25 {
		gen cow`x'=0
		}


	gen cow2p = 0
	gen cow3p = 0
	gen cow4p = 0

	*Generate event time dummies
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
		forval x=1/25 {
		replace cown`x' = 1 if a_incorp == "`state'" & ayear == year(``state'_cow')-`x'
		}
		}	
		
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
		forval x=0/25 {
		replace cow`x' = 1 if a_incorp == "`state'" & ayear == year(``state'_cow')+`x'
		}
		}
		
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
		replace cow2p = 1 if a_incorp == "`state'" & ayear >= year(``state'_cow')+2
		replace cow3p = 1 if a_incorp == "`state'" & ayear >= year(``state'_cow')+3
		replace cow4p = 1 if a_incorp == "`state'" & ayear >= year(``state'_cow')+4
		}

	*Generate interaction terms (Xcar) 
	forval x=1/25 {
		gen cown`x'Xcar = cown`x'*a_car0101_r
		}

	forval x=0/25 {
		gen cow`x'Xcar = cow`x'*a_car0101_r
		}

	gen cow2pXcar = cow2p*a_car0101_r
	gen cow3pXcar = cow3p*a_car0101_r
	gen cow4pXcar = cow4p*a_car0101_r
			
			
	reghdfe d_withdrawn   l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic a_car0101 cown3 cown2 cown1 cow0 cow1 cow2 cow3p cown3Xcar cown2Xcar cown1Xcar cow0Xcar cow1Xcar cow2Xcar cow3pXcar, absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)


	
	
	local nonmiss "a_car0101_r a_cow l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic"
	foreach v of local nonmiss {
	drop if missing(`v')
	}

	estpost tabstat a_car0101_r a_ceoownership, statistics (n p5 p10 p25 p50 p75) columns(statistics)
	drop if  a_car0101_r >-.08473 
	tabstat d_withdrawn, statistics(n mean  ) by (a_cow)
	prtest d_withdrawn, by(a_cow)

	
	
*******************************
* Figure B2 Block permutation *
*******************************
	
	use "C:\cow\ma.dta",clear
	drop if a_fyear<1996
	drop if a_sic >= 4900 & a_sic <= 4999
	drop if a_sic >= 9000 & a_sic <= 9999
	encode a_cusip, gen(a_cusipFE)
	encode a_state, gen(a_stateFE)
	encode t_incorp, gen(t_incorpFE)	
	drop if missing(a_state)
	drop if missing(a_incorp)
	drop if inlist(a_incorp, "AS", "INTL", "PR", "TT", "VI")
	drop if missing(l_a_mktcap, a_q, a_lvb, a_amihudliq, a_roa, rel_size, d_t_private, d_t_sub ,d_allcash, d_tender, d_hostile, d_compete, d_toehold, d_lockup, d_moe, d_same2sic)

	local statelist "DE OK MO KS TX NV NJ MD WA"
	gen treatment = 0
	foreach state of local statelist {
			replace treatment = 1 if a_incorp == "`state'"
	}

	
	
	*Create macros for date when law was passed
	local DE_cow = date("01Jul2000","DMY")
	local OK_cow = date("01Nov2001","DMY")
	local MO_cow = date("01Oct2003","DMY")
	local KS_cow = date("01Jan2005","DMY")
	local TX_cow = date("01Jan2006","DMY")
	local NV_cow = date("01Oct2007","DMY")
	local NJ_cow = date("11Mar2011","DMY")
	local MD_cow = date("01Oct2014","DMY")
	local WA_cow = date("01Jan2016","DMY")
	

	* adjust calendar year of fyeendt to be next year if fyenddt month < cow law date
	gen ayear = year(a_fyenddt)
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
			replace ayear = year(a_fyenddt)-1 if a_incorp == "`state'" & month(a_fyenddt) < month(``state'_cow')
			}

	*cow: indicator equal to one if acquirer is incorporated in a state that has passed a COW law
	gen a_cow = 0
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
			replace a_cow = 1 if a_incorp == "`state'" & ayear >= year(``state'_cow')
			}

	*Create macros for date when law was passed
	local DE_cow = date("01Jul2000","DMY")
	local OK_cow = date("01Nov2001","DMY")
	local MO_cow = date("01Oct2003","DMY")
	local KS_cow = date("01Jan2005","DMY")
	local TX_cow = date("01Jan2006","DMY")
	local NV_cow = date("01Oct2007","DMY")
	local NJ_cow = date("11Mar2011","DMY")
	local MD_cow = date("01Oct2014","DMY")
	local WA_cow = date("01Jan2016","DMY")

	* adjust calendar year of fyeendt to be next year if fyenddt month < cow law date
	gen tyear = year(t_fyenddt)
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
			replace tyear = year(t_fyenddt)-1 if t_incorp == "`state'" & month(t_fyenddt) < month(``state'_cow')
			}
	*cow: indicator equal to one if target is incorporated in a state that has passed a COW law
	gen tgt_cow = 0
	local statelist "DE OK MO KS TX NV NJ MD WA"
	foreach state of local statelist {
			replace tgt_cow = 1 if t_incorp == "`state'" & tyear >= year(``state'_cow')
			}

	forval y= 1/250 {
	bysort incorp_no: gen ryear_`y' = runiformint(1996,2018)
	bysort incorp_no: replace ryear_`y' = ryear_`y'[1]
	bysort incorp_no: gen treatment_`y' = runiformint(0,1)
	bysort incorp_no: replace treatment_`y' = treatment_`y'[1]
	gen cow_`y' =0
	replace cow_`y' =1 if treatment_`y'==1 & a_fyear >= ryear_`y'
	gen carcow_`y'=a_car0101_r*cow_`y'
	quietly reghdfe d_withdrawn carcow_`y' cow_`y' a_car0101_r l_a_mktcap a_q a_lvb a_amihudliq a_roa rel_size d_t_private d_t_sub d_allcash d_tender d_hostile d_compete d_toehold d_lockup d_moe d_same2sic, absorb(a_state_yearad a_ind3d_yearad) vce(cluster a_incorp)
	estimate store m`y'
	drop ryear_`y' treatment_`y' cow_`y' carcow_`y'
	}

	estout m* using "withdrawn_loop1.csv", cells(b) replace

	
	
	
